 
module Cms
  class TextFragment < FieldFragment

    state_defined_by :data => 'click here to edit me'

    def build
      e :div, 
        :innerHTML => data,
        :class => 'f-static'
      e :textarea, 
        :type => "text",
        :innerHTML => data,
        :class => 'f-editable'
      
      e :script, "
        dcat_instance.oninit(function(Y) { 
          new Cat.fragments.TextField(document.getElementById('#{id}'), #{options});
        });"
    end
  end
end